package com.itce.arco.practicenote.day02.practice3;

public class Test {
    public static void main(String[] args) {
        // 参数的多态
        //创建奔弛车
        /*BenzCar bz = new BenzCar("奔弛C200","奔弛","黑色",43);
        BenzSUV banZSUV = new BenzSUV("奔弛GLK","奔弛","黑色",150);
        //创建宝马车
        BMWSUV bmwsuv = new BMWSUV("宝马X5","宝马","黑色",97);
        BMWCar bmwCars = new BMWCar("宝马530","宝马","白色",50);

        SalesPerson salesPerson = new SalesPerson();
        salesPerson.sell(banZSUV);
        salesPerson.sell(bmwsuv);*/

        // 变量的多态
/*
        Car car = new BenzCar("奔弛C200","奔弛","黑色",43);
        car.run();
        car = new BMWCar("宝马530","宝马","白色",50);
        car.run();
*/

        // 返回指的多态
        SalesPerson salesPerson = new SalesPerson();
        salesPerson.sell(1).run();
        salesPerson.sell(2).run();
        salesPerson.sell(3).run();
        salesPerson.sell(4).run();

        // 匿名局部内部类
        salesPerson.sell(new Car() {
            @Override
            public void run() {
                System.out.println("匿名局部内部类");
            }
        });

    }
}
